package com.ybkj.o2o.mc.manager;

import java.util.List;

import com.ybkj.o2o.mc.common.DataGrid;
import com.ybkj.o2o.mc.common.query.DepartmentQuery;
import com.ybkj.o2o.mc.entity.Department;
import com.ybkj.o2o.mc.entity.PassengerAccount;

/**
 * 
 * @author Yuan Tianyang.---2017/6/30
 *
 */
public interface DepartmentManager {

	/**
	 * 通过姓名和appKey查询部门
	 * 
	 * @param departmentName
	 * @param appKey
	 * @param enterpriseId 
	 * @return
	 */
	Department exists(String name, String appKey, Long enterpriseId);
	
	/**
	 * 新增部门
	 * 
	 * @param department
	 * @return
	 */
	Department insert(Department department);
	
	/**
	 * 分页根据条件查询部门信息
	 * 
	 * @param department
	 * @return
	 */
	DataGrid<Department> findByDepartmentQuery(DepartmentQuery departmentQuery);
	
	/**
	 * 根据id和appKey查询部门
	 * 
	 * @param id
	 * @param appKey
	 * @return
	 */
	Department findByIdAndAppKey(Long id, String appKey);
	
	/**
	 * 根据id修改部门信息
	 * 
	 * @param department
	 * @return
	 */
	int updateByPrimaryKey(Department department);
	  /**
	   * 删除指定企业信息.
	   *
	   * @param id 企业主键
	   * @param appKey       系统key
	   * @return 删除的数量
	   */
	int deleteByPrimaryKey(Long id, String appKey);	
	  /**
	   * 部门账户充值.
	   *
	   * @param department     部门信息
	   * @param account        充值记录
	   * @param updateBlance   是否修改余额
	   * @param useNoDrawMoney 使用不可提现金额
	   * @return 充值记录明细
	   */
	 PassengerAccount updateAccount(Department Department, PassengerAccount account,boolean updateBlance, boolean useNoDrawMoney);

	 /**
	  * 批量删除企业信息
	  * 
	  * @param departmentIds
	  * @param appKey
	  * @return
	  */
	 int batchDeleteByIds(List<Long> departmentIds, String appKey);

	 int updateEnterpriseNameByEnterpriseId(Long enterpriseId, String enterpriseName, String appKey);

	 int updateCompanyName(Long companyId, String abbreviation, String appKey);
}
